let rec filter p l=
if (l = []) then ([]) 
	else (
	   if ((p (head l)) = true) then 
	      ( (head l) :: (filter p (tail l)) )
	   else (filter p (tail l))
	      ) 
in

let rec append l m =
if (l = []) then m else ((head l) :: (append (tail l) m) ) 
in

let rec quicksort l =
	if (l = []) then [] else
	   (
	   let pivot = (head l) in
	   let rest = (tail l) in
	   let is_less = (fun x -> (x < pivot) ) in
	   let is_greater = (fun y -> (y >= pivot) ) in
	   let left = (filter is_less rest) in
	   let right = (filter is_greater rest) in
	   (append (quicksort left) (pivot :: (quicksort right)))
	   )
in
(quicksort ([1;6;2;8;3;4]) )
;;
	   















		
